home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / terminal / winpack / wpext / aakext.bas next >
Encoding:
BASIC Source File  |  1996-06-02  |  2.2 KB  |  84 lines

  1. '**********************************************************
  2. 'A single session external program for use with Winpack 5.4
  3. '**********************************************************
  4.  
  5. DIM status AS INTEGER
  6. DIM PMSCall AS STRING
  7. DIM FirstName AS STRING
  8. DIM ConnectedStation AS STRING
  9. DIM UserText AS STRING
  10. crlf$ = CHR$(13) + CHR$(10)
  11.  
  12. '********************************************
  13. 'Extract five arguments from the command line
  14. '********************************************
  15.  
  16. c$ = COMMAND$
  17. n% = 1
  18. argcount% = 1
  19. agin:
  20. tmp$ = MID$(c$, n%, 1)
  21. IF (tmp$ = " ") OR (tmp$ = "") THEN GOTO caught1
  22. carryon:
  23. n% = n% + 1
  24. GOTO agin
  25.  
  26. caught1:
  27. IF n% > (LEN(c$) + 1) THEN GOTO disp
  28.  
  29. SELECT CASE argcount%
  30. CASE 1
  31. arg1$ = MID$(c$, 1, n% - 1)
  32. argcount% = argcount% + 1
  33. totcrs% = LEN(arg1$)
  34. GOTO carryon
  35. CASE 2
  36. arg2$ = MID$(c$, totcrs% + 2, n% - (totcrs% + 2))
  37. totcrs% = totcrs% + LEN(arg2$)
  38. argcount% = argcount% + 1
  39. GOTO carryon
  40. CASE 3
  41. arg3$ = MID$(c$, totcrs% + 3, n% - (totcrs% + 3))
  42. totcrs% = totcrs% + LEN(arg3$)
  43. argcount% = argcount% + 1
  44. GOTO carryon
  45. CASE 4
  46. arg4$ = MID$(c$, totcrs% + 4, n% - (totcrs% + 4))
  47. totcrs% = totcrs% + LEN(arg4$)
  48. argcount% = argcount% + 1
  49. GOTO carryon
  50. CASE 5
  51. arg5$ = MID$(c$, totcrs% + 5, (LEN(c$) - (totcrs% + 4)))
  52. GOTO disp
  53. END SELECT
  54.  
  55. disp:
  56. '*****************************************
  57. 'These are our five command line arguments
  58. '*****************************************
  59. status = VAL(arg1$)
  60. PMSCall = arg2$
  61. FirstName = arg3$
  62. ConnectedStation = arg4$
  63. UserText = arg5$
  64.  
  65. '***************************************
  66. 'This is where you can put your actual
  67. 'external program to do something useful
  68. '***************************************
  69.  
  70. '*********************************
  71. 'create a reply file for Winpack
  72. '*********************************
  73.  
  74. OPEN "EXTERN\AAKEXT.REP" FOR OUTPUT AS #1
  75. status = -1: ' because we've finished with this program for this session
  76. RepText1$ = crlf$ + "Hello " + ConnectedStation + " Welcome to " + PMSCall + crlf$
  77. RepText2$ = "This is AAKEXT - an example external program for Winpack " + crlf$
  78. RepText3$ = "You entered " + arg5$ + " on the command line " + crlf$
  79. PRINT #1, status, RepText1$, RepText2$, RepText3$
  80. CLOSE #1
  81.  
  82. END
  83.  
  84.